# -*- coding: utf-8 -*-
import scrapy
from douyu.items import DouyuItem

class DemoSpider(scrapy.Spider):
    name = 'demo'
    allowed_domains = ['douyu.com']
    start_urls = ['https://www.douyu.com/directory/all']

    def parse(self, response):
        item = {}
        div_list = response.xpath('//h3[@class="DyListCover-intro"]')
        a = 1
        for div in div_list:
            a += 1
            # item = DouyuItem()
            item[a] = div.xpath('./text()')[0].extract()
            # print(item)
            yield item

